 #include <stdio.h>
#include <string.h>
//结构体定义 不给名字 同时定义⼀个变量 然后赋值
typedef struct
{
 char name[32];
 int age;
 char sex;
} stu_t;
stu_t func(int age,char sex,char *str)
{
 stu_t temp;
 temp.age = age;
 strcpy(temp.name,str);
 temp.sex = sex;
 return temp;
}
 
int main(int argc,const char * argv[])
{
 stu_t stu1,stu2;
 stu1 = func(18,'m',"yanglaoshi");
 stu2 = func(20,'n',"xiaoli");
 printf("age = %d\n",stu1.age);
 printf("name = %s\n",stu1.name);
 printf("sex = %c\n",stu1.sex);
 printf("age = %d\n",stu2.age);
 printf("name = %s\n",stu2.name);
 printf("sex = %c\n",stu2.sex);
 return 0;
}